import { Component, Inject, OnInit} from '@angular/core';
import { OverlayContainer } from '@angular/cdk/overlay';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {


  darkTheme: boolean;

  constructor(private oc: OverlayContainer) {
    this.darkTheme = false;
  }

  ngOnInit(): void {}
  // 改变主题
  switchTheme(dark: boolean) {
    this.darkTheme = dark;
    if ( dark ) {
      this.oc.getContainerElement().classList.add('myapp-dark-theme' );
    }else {
      this.oc.getContainerElement().classList.remove('myapp-dark-theme');
    }
  }
}
